{include file="public/header" /}
<title></title>
</head>
<body>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 联盟管理 <span class="c-gray en">&gt;</span> 联盟列表
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li><strong>联盟列表</strong></li>
	</ol>
</div>
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('search')}">
		    <div class="row">
				<div class="form-group">
					<span class="bspan">负责人名称</span><input type="text" id="shopowner" name="shopowner" value="" placeholder="请输入名称" class="bank" />
					<span class="bspan">联盟名称</span><input type="text" id="name" name="name" value="" placeholder="请输入名称" class="bank" />
					<span class="bspan">审核状态</span><select name="status" class="bank">
						<option value="0">全部</option>
						<option value="1">审核中</option>
						<option value="2">审核通过</option>
						<option value="3">审核不通过</option>
					</select>
				    <span class="bspan">添加时间</span>
				    <input type="text" id='createtime' name='createtime'   onclick='WdatePicker()'  placeholder="开始时间" class="bank" />
		            <span class="bspan">至</span>
	            	<input type="text" id='end_time' name='end_time'   onclick='WdatePicker()'  placeholder="结束时间" class="bank" />
                  	<input type='hidden' name="end_time"  value="2017-4-1" >					
					<span class="bank" style="border-radius:0px;border:1px;"><button type="submit" class="btn btn-sm btn-primary"><li class="fa fa-search"> 查询</li></button> </span>
				</div> 
        	</div>
        </form>
            <div class="example-wrap">
                <div class="example">
                   <table class="table table-border table-bordered table-bg">
                        <thead >
                            <tr class="long-tr" >
                                <th>id</th>
                                <th style="text-align: center;">logo</th>
                                <th style="text-align: center;"	>名称</th>
                                <th style="text-align: center;width: 10%;">地址</th>
                                <th style="text-align: center;">电话</th>
                                <th style="text-align: center;">创建时间</th>
                                <th style="text-align: center;">联盟盟主</th>
                                <th style="text-align: center;">审核状态</th>
                                <th style="text-align: center;">联盟状态</th>
                                <th style="text-align: center;">操作</th>
                            </tr>
                        </thead>
                        <tbody id="list">
                        	{volist name="list" id='ad'}
                        	<tr>
                        		<td>{$ad.id}</td>
                        		<td><img src="{$ad.thumb}"  width="50px"/></td>
                        		<td><a href="{:url('edit',['id'=>$ad.id])}" >{$ad.name}</a></td>
                        		<td>{$ad.address}</td>                       		
                        		<td>{$ad.tel}</td>
                        		<td>{$ad.add_time}</td>
                        		<td>{$ad.mobile}</td>
                        		<td>
                        			<a href="{:url('examines',['id'=>$ad.id,'is_examines'=>1])}" class="btn btn-danger bnt-sm">
										<i class="fa fa-paste"></i> 查看资料</a>
                        			{if $ad.state == 2}
                        			<a href="#" class="btn btn-danger bnt-sm">
										<i class="fa fa-paste"></i> 已审核</a>
									{else}
                        			<a href="#" onclick="examines('{$ad.id}',2)" class="btn btn-primary bnt-sm">
										<i class="fa fa-paste"></i> 审核通过</a>
                        			<a href="#" onclick="examines('{$ad.id}',3)" class="btn btn-danger bnt-sm">
										<i class="fa fa-paste"></i> 审核不通过</a>
                        			{/if}
                        		</td>
                        		<td>
								{if $ad.is_state == 1}
                    			<a href="#" class="btn btn-primary">正常</a>
                    			{elseif $ad.is_state == 2}
                    			<a href="#" class="btn btn-danger">已关闭</a>
                    			{else}
                    				<a href="#" class="btn btn-danger">已解散</a>
                    			{/if}
                        		</td>
                        		<td>	
									<a href="{:url('show',['id'=>$ad.id])}" class="btn btn-primary bnt-sm">
									<i class="fa fa-paste"></i> 查看成员</a>
                        		</td>
                        	</tr>
                        	{/volist}
                        </tbody>
                    </table>
                    <style>
					.pagination li{float: left;}
					</style>
					<div id="pageNav" class="pageNav">{$list->render()}</div>
                </div>
            </div>
</div>
{include file="public/footer" /}
<script src="__PUBLIC__/static/lib/datepicker/WdatePicker.js"></script>
<script>
	function examines(union_id,state){
		$.ajax({
			type:"post",
			//请求的url
			//注意，如果我们使用路由器的情况下，我们需要设置一下本地服务器的ip地址
			url: "{:url('admin/Union/examines')}",
			//请求的过程中传递过去的参数 json
			data: {
				union_id : union_id,
				state	 : state
			},
			//成功了的回调，并且带有返回值
			success: function(data) {
				layer.msg(data.msg);
				location.replace(location.href);
			}
		})
	}
	
</script>
